package com.vainycos.lotterysearch.controller;

import com.vainycos.lotterysearch.model.base.Result;
import com.vainycos.lotterysearch.service.notify.DingNotify;
import com.vainycos.lotterysearch.utils.FreeApiUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: Vainycos
 * @description
 * @date: 2022/11/17 10:03
 */
@RestController
@RequestMapping("/dingNotify")
public class DingNotifyController {

    @Autowired
    private DingNotify dingNotify;

    /**
     * 推送普通文本消息
     * @param text
     * @return
     */
    @GetMapping("/pushText")
    public Result pushText(String text){
        dingNotify.notifyText(text);
        return Result.of(true);
    }

    /**
     * 推送天气消息
     */
    @GetMapping("/pushWeather")
    public Result pushWeather(){
        dingNotify.notifyText(FreeApiUtil.realTimeweather());
        return Result.of(true);
    }



}
